<?php
/**
 * Created by PhpStorm.
 * User: u
 * Date: 2019/3/28
 * Time: 10:43
 */
namespace common\sources\read\taskcommodkeywords;

use common\models\craftsman\TaskCommodKeywords;

class TaskCommodKeywordAccess implements ITaskCommodKeywordAccess
{
   public function getTaskCommodKeyword($task_commod_id)
   {
        return TaskCommodKeywords::find()
                ->select("id,bus_id,task_commod_id,word,num,use_num,create_time")
                ->where('task_commod_id ='.$task_commod_id.' AND num > use_num')
                ->asArray()
                ->all();
   }

   public function getTaskCommodKeywordById($task_commod_keyword_id)
   {
       return TaskCommodKeywords::find()
           ->select("id,bus_id,task_commod_id,word,num,use_num,create_time")
           ->where('id = '.$task_commod_keyword_id)
           ->asArray()
           ->one();
   }
}